package com.educate.admin.web.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.educate.common.web.R;
import com.educate.device.model.bo.MemberBO;
import com.educate.member.rpc.api.MemberService;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 后台统一接口中心
 * Created by shuzheng on 2017/2/19.
 */
@Log4j2
@RestController
public class TestController {

    @Reference(version = "${api.service.version}",
            application = "${dubbo.application.id}",
            url = "${dubbo.member.url}")
    private MemberService memberService;

    @GetMapping(value = "/hello")
    public R<String> hello() {
        log.debug("-----------------hello-----------------");
        return R.ok("hello");
    }

    @GetMapping(value = "/member/{memberId}")
    public R<MemberBO> member(@PathVariable String memberId) {
        log.debug("-----------------member-----------------");
        return R.ok(memberService.detail(memberId));
    }

}